<!-- 项目管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">校内-报名列表</p>

    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      :qx="qx"
      ref="databale"
    ></dxtable>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../../components/util/dxtable.vue";
import sort from "../../../components/util/sort.vue";
import { dxget, dxpost } from "../../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const fdfdsgta = ref([]);
const databale = ref();
const kxcxdf = ref([]);
const jxcxfd = [];
const initeer = () => {
  databale.value.initDataExpose();
};
let dataJson = [
  {
    title: "学生姓名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "手机号",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "phone",
    width: "",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "年级",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "nianji",
    width: "",
    search: false,
    istable: true,
    required: false,
    render: (row) => {
      const xcgrte = [];
      fdfdsgta.value.map((a) => {
        row.nianji.split(",").map((b) => {
          if (a.value == b) {
            xcgrte.push(a.label);
          }
        });
      });
      return xcgrte.join(",");
    },
  },
  {
    title: "班级",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "banji",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "第三节课",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "xczxdaname",
    width: "",
    search: false,
    istable: true,
    required: false,
    render(row) {
      try {
        let oxsdr = kxcxdf.value.filter((a) => a.id == row.xczxda)[0];
        return oxsdr.name;
      } catch (e) {}
    },
  },
  {
    title: "第四节课",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "xczxdbname",
    width: "",
    search: false,
    istable: true,
    required: false,
    render(row) {
      try {
        let oxsdr = kxcxdf.value.filter((a) => a.id == row.xczxdb)[0];
        return oxsdr.name;
      } catch (e) {}
    },
  },

  {
    title: "报名时间",
    key: "addTime",
    width: 150,
  },
];

const qx = {
  DeletePermissionID: "123456", //删除
  EditPermissionIdentifier: "cjsglbj", // 编辑
  NewPermissionIdentifier: "cjsglxz", // 新建
  ViewPermissionID: "cjsglck", // 查看
};
const portUrl =
  "courseManagement/xwbmListjg/xwbmListjg?xxid=" + localStorage.xxid;

let formJson = reactive([
  {
    title: "学生姓名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "",
    search: false,
    istable: true,
    required: true,
  },
  {
    title: "手机号",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "phone",
    width: "",
    search: false,
    istable: true,
    required: true,
  },
  {
    title: "年级",
    type: "select",
    options: [],
    val: "",
    icon: "dx-shurukuang",
    span: 24,
    key: "nianji",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "班级",
    type: "select",
    options: jxcxfd,
    val: "",
    icon: "dx-shurukuang",
    span: 24,
    key: "banji",
    width: "",
    search: false,
    istable: true,
    required: false,
  },

  {
    title: "",
    type: "",
    val: localStorage.xxid,
    span: 24,
    key: "xxid",
    istable: true,
    required: true,
  },
]);
const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {},
        },
        "复制代码"
      ),
    ];
  },
};

// 获取字典内容
const xtgxxmfl = async () => {
  const { data }: any = await dxget("dxgjAdmin/getzd/getzdJsList?ids=316,343");
  fdfdsgta.value = data[0];
  formJson[2].options = data[0];
  formJson[4].options = data[1];
};
xtgxxmfl();

const kcxcfsf = async () => {
  const { data } = await dxget("courseManagement/erqi/getxwkcList", {
    xxid: localStorage.xxid,
  });
  kxcxdf.value = data;
};
kcxcfsf();
</script>
<style scoped></style>
